package com.qq.pojo;

import java.io.Serializable;

/**
 * @author： Aeolia
 * @Description： TODO
 * @Date： 2021/10/17 0:02
 */
public class Message implements Serializable {

    private CODE code;
    private Long messageId;
    private MessageType messageType;
    private Object data;


    public Message(CODE code, MessageType messageType, Object data) {
        this.code = code;
        this.messageId = createMessageId();
        this.messageType = messageType;
        this.data = data;
    }

    private Long createMessageId(){
        return System.currentTimeMillis();
    }

    public CODE getCode() {
        return code;
    }

    public void setCode(CODE code) {
        this.code = code;
    }

    public Long getMessageId() {
        return messageId;
    }

    public void setMessageId(Long messageId) {
        this.messageId = messageId;
    }

    public MessageType getMessageType() {
        return messageType;
    }

    public void setMessageType(MessageType messageType) {
        this.messageType = messageType;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Message{" +
                "code=" + code +
                ", messageId=" + messageId +
                ", messageType=" + messageType +
                ", data=" + data +
                '}';
    }
}
